package com.obradovicnjegovan.webprodavnica.so.impl;

import org.apache.tapestry5.ioc.annotations.Inject;

import com.obradovicnjegovan.webprodavnica.dao.HibernateDao;
import com.obradovicnjegovan.webprodavnica.so.Obrisi;

public class ObrisiImpl<T> implements Obrisi<T>{
	@Inject
	private HibernateDao hibernateDao;
	private T objekat;
	
	public HibernateDao getHibernateDao() {
		return hibernateDao;
	}
	public void setHibernateDao(HibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}
	public T getObjekat() {
		return objekat;
	}
	public void setObjekat(T objekat) {
		this.objekat = objekat;
	}
	public Object execute() {
		try {
			hibernateDao.delete(getObjekat());
			return "Uspesno obrisan objekat";
		} catch (Exception e) {
			return "Sistemska greska. Neuspesno obrisan objekat. Problem: "+e;
		}
	}
}
